﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderPartial("../Layout/admin_menu"); %>
    <ul class="breadcrumb">
        <li><a href="/Admin/Members">Tous les membres</a> <span class="divider">&raquo;</span></li>
        <li class="active"><a href="/Admin/Historique">Historique</a> <span class="divider">&raquo;</span></li>
    </ul>
    <h2>Historique</h2>
    <% if (Model.getEmpruntHistory().Count == 0) { %>
    <div class="alert alert-info">Aucun emprunt a ce jour</div>
    <% } else {%>
    <table class="table table-bordered table-striped">
        <thead>
            <tr>
                <th>#ID</th>
                <th>Membre</th>
                <th>Oeuvre</th>
                <th>Type</th>
                <th>Date d'emprunt</th>
                <th>Date de retour</th>
            </tr>
        </thead>
        <% foreach (var emp in Model.getEmpruntHistory()) { %>
        <% var user = Model.getMemberById(emp.user); var movie = Model.getMovieById(emp.media); %>
        <tr>
            <td><%= emp.id %></td>
            <td><a href="/Admin/Members/Edit/<%= user[0].id %>"><%= user[0].username %></a></td>
            <td><a href="/Admin/Films/Edit/<%= movie[0].id %>"><%= movie[0].title %></a></td>
            <td><%= emp.type %></td>
            <td><%= emp.date_emprunt %></td>
            <td><%= emp.date_retour %></td>
        </tr>
        <% } %>
    </table>
    <% } %>
</asp:Content>

